{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": 1,
   "metadata": {},
   "outputs": [],
   "source": [
    "import warnings\n",
    "warnings.filterwarnings('ignore')\n",
    "import os"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 2,
   "metadata": {},
   "outputs": [],
   "source": [
    "__file__ = 'InceptionResNetV2-8.27.2-1'\n",
    "os.environ[\"CUDA_VISIBLE_DEVICES\"] = \"1\""
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 3,
   "metadata": {},
   "outputs": [
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      "Using TensorFlow backend.\n"
     ]
    }
   ],
   "source": [
    "from keras.preprocessing.image import ImageDataGenerator\n",
    "from glob import glob\n",
    "import tensorflow as tf\n",
    "import numpy as np\n",
    "import pandas as pd\n",
    "import matplotlib.pyplot as plt\n",
    "import keras\n",
    "from keras.applications.inception_v3 import InceptionV3\n",
    "from keras.applications.xception import Xception\n",
    "from keras.applications.resnet50 import ResNet50\n",
    "from keras_applications.resnext import ResNeXt50\n",
    "from keras.applications.nasnet import NASNetLarge\n",
    "from keras.applications.inception_resnet_v2 import InceptionResNetV2\n",
    "from keras.models import *\n",
    "from keras.layers import *\n",
    "from keras.optimizers import *\n",
    "from keras.callbacks import *\n",
    "import PIL\n",
    "import time\n",
    "\n",
    "def preprocess_img(x):\n",
    "    x = x / 127.5\n",
    "    x -= 1.\n",
    "    return x"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 4,
   "metadata": {},
   "outputs": [],
   "source": [
    "path_data = '../garbage_classify/train_data'\n",
    "batch_size = 64\n",
    "img_size = 299\n",
    "img_width = img_size\n",
    "img_height = img_size\n",
    "random_seed = 201908\n",
    "path_data_train = '../tmp/data_train/'\n",
    "path_data_valid = '../tmp/data_valid/'\n",
    "labels_file = '../tmp/labels_raw.csv'"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 5,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "<matplotlib.axes._subplots.AxesSubplot at 0x7fd1bdc1db38>"
      ]
     },
     "execution_count": 5,
     "metadata": {},
     "output_type": "execute_result"
    },
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAAX0AAAEGCAYAAACJnEVTAAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAALEgAACxIB0t1+/AAAADh0RVh0U29mdHdhcmUAbWF0cGxvdGxpYiB2ZXJzaW9uMy4xLjEsIGh0dHA6Ly9tYXRwbG90bGliLm9yZy8QZhcZAAATcElEQVR4nO3df5Bd5X3f8fcHIaRSCNYvGIIgghZTgcEUVgTHPyJnXJBwO0CGcUlJrYl/EBwntTNTxqTjCbE9dIynSRPZAVutKWRqQzC2sVpTI0EBN40BixRj8VMqhtESQDKyMcUGS/DtH/csvVlWP3ZX0r3q837N7Nxzn/Occ7/7jPS5Z59z7rmpKiRJbThg0AVIkvYdQ1+SGmLoS1JDDH1JaoihL0kNOXDQBezM/Pnza9GiRYMuQ5L2K/fdd98Pq2rBROuGOvQXLVrEunXrBl2GJO1Xkjy5o3VO70hSQwx9SWqIoS9JDRnqOX1JGm/btm2Mjo7y0ksvDbqUgZs9ezYLFy5k5syZu72NoS9pvzI6Osqhhx7KokWLSDLocgamqnjuuecYHR3l2GOP3e3tnN6RtF956aWXmDdvXtOBD5CEefPmTfovHkNf0n6n9cAfM5VxMPQlqSGGviRNwcqVK1m8eDEXXXTRoEuZFE/kStIUXHXVVdx2220sXLhw0KVMikf6kjRJl1xyCY8//jjLly/nsMMO433vex9Lly7luOOOY+XKla/1O++88zj99NM56aSTWLVq1WvthxxyCJdeeiknnXQS73rXu7j33ntf23716tUAvPLKK1x66aUsWbKEU045hS984Qt7pPYM89cljoyMlPfekdTv4YcfZvHixQB84r88yEN/+5M9uv8Tf/EXuPyfnbTLfmP3Bvvc5z7HmjVruOOOO3jhhRc44YQTeOaZZ5g5cyZbt25l7ty5/OxnP2PJkiXcddddr115dMstt7B8+XLOP/98XnzxRb75zW/y0EMPsWLFCu6//35W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3A0Jekhhj6ktQQQ1+SGmLoS1JDDH2pT5KdXl6XZFH/XUB3c5/XJrlg1z2lvc/Ql6SGGPrSBJIckuT2JH/TfVdC/11eD0zypSQPJ7kpycHdNqcnuau78d6t4z71Kg0FQ1+a2EvA+d2N9N4J/HH30XqAE4Crqmox8BPgd7r723yW3r3UTweuAYbmk9nSmAN33UVqUoB/290x9VV6t/Mdu03ypqr6n93yfwb+FfAt4E3A2u69YQa9u1dKQ8XQlyZ2Eb17qJxeVduSPAHM7taNv3dJ0XuTeLCq3rLvSpQmz+kdaWKHAZu7wH8n8Et9645JMhbu/wL4K+BRYMFYe5KZSU7apxVLu8HQlyb2JWAkyfeB9wKP9K17lN6X5TwMzAGu7r7W8wLgyiTfo3eHxV/ZxzVLu+RdNiWpIR7pS1JDDH1JaoihL0kNMfQlqSGGviQ1xNCXpIYY+pLUkP8LKWxi8D45m+sAAAAASUVORK5CYII=\n",
      "text/plain": [
       "<Figure size 432x288 with 1 Axes>"
      ]
     },
     "metadata": {
      "needs_background": "light"
     },
     "output_type": "display_data"
    }
   ],
   "source": [
    "labels_train = pd.read_csv('../tmp/labels_train.csv')\n",
    "labels_valid = pd.read_csv('../tmp/labels_valid.csv')\n",
    "n_classess = labels_train.label.unique().shape[0]\n",
    "labels_train.groupby(by='label').count().plot()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 6,
   "metadata": {},
   "outputs": [],
   "source": [
    "labels_train.label = labels_train.label.apply(lambda x: f'{x:02d}')\n",
    "labels_valid.label = labels_valid.label.apply(lambda x: f'{x:02d}')\n",
    "# labels_train['label_bin'].values = keras.utils.np_utils.to_categorical(\n",
    "#     labels_train.label, n_classess)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 7,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Found 40000 validated image filenames belonging to 40 classes.\n",
      "Found 2978 validated image filenames belonging to 40 classes.\n"
     ]
    }
   ],
   "source": [
    "ig = ImageDataGenerator(preprocessing_function=preprocess_img)\n",
    "\n",
    "params_g = dict(\n",
    "    batch_size=batch_size,\n",
    "    # directory=path_data,\n",
    "    # class_mode='other',\n",
    "    x_col='fname',\n",
    "    y_col='label',\n",
    "    target_size=(img_width, img_height),\n",
    "    interpolation='lanczos',\n",
    "    seed=random_seed)\n",
    "\n",
    "train_g = ig.flow_from_dataframe(\n",
    "    labels_train, path_data_train, **params_g)\n",
    "valid_g = ig.flow_from_dataframe(\n",
    "    labels_valid, path_data_valid, **params_g)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 8,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "WARNING:tensorflow:From /usr/local/lib/python3.6/dist-packages/tensorflow/python/framework/op_def_library.py:263: colocate_with (from tensorflow.python.framework.ops) is deprecated and will be removed in a future version.\n",
      "Instructions for updating:\n",
      "Colocations handled automatically by placer.\n"
     ]
    }
   ],
   "source": [
    "base_model = InceptionResNetV2(\n",
    "    weights='imagenet', include_top=False, input_shape=(img_width, img_height, 3))"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 9,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "0 input_1\n",
      "1 conv2d_1\n",
      "2 batch_normalization_1\n",
      "3 activation_1\n",
      "4 conv2d_2\n",
      "5 batch_normalization_2\n",
      "6 activation_2\n",
      "7 conv2d_3\n",
      "8 batch_normalization_3\n",
      "9 activation_3\n",
      "10 max_pooling2d_1\n",
      "11 conv2d_4\n",
      "12 batch_normalization_4\n",
      "13 activation_4\n",
      "14 conv2d_5\n",
      "15 batch_normalization_5\n",
      "16 activation_5\n",
      "17 max_pooling2d_2\n",
      "18 conv2d_9\n",
      "19 batch_normalization_9\n",
      "20 activation_9\n",
      "21 conv2d_7\n",
      "22 conv2d_10\n",
      "23 batch_normalization_7\n",
      "24 batch_normalization_10\n",
      "25 activation_7\n",
      "26 activation_10\n",
      "27 average_pooling2d_1\n",
      "28 conv2d_6\n",
      "29 conv2d_8\n",
      "30 conv2d_11\n",
      "31 conv2d_12\n",
      "32 batch_normalization_6\n",
      "33 batch_normalization_8\n",
      "34 batch_normalization_11\n",
      "35 batch_normalization_12\n",
      "36 activation_6\n",
      "37 activation_8\n",
      "38 activation_11\n",
      "39 activation_12\n",
      "40 mixed_5b\n",
      "41 conv2d_16\n",
      "42 batch_normalization_16\n",
      "43 activation_16\n",
      "44 conv2d_14\n",
      "45 conv2d_17\n",
      "46 batch_normalization_14\n",
      "47 batch_normalization_17\n",
      "48 activation_14\n",
      "49 activation_17\n",
      "50 conv2d_13\n",
      "51 conv2d_15\n",
      "52 conv2d_18\n",
      "53 batch_normalization_13\n",
      "54 batch_normalization_15\n",
      "55 batch_normalization_18\n",
      "56 activation_13\n",
      "57 activation_15\n",
      "58 activation_18\n",
      "59 block35_1_mixed\n",
      "60 block35_1_conv\n",
      "61 block35_1\n",
      "62 block35_1_ac\n",
      "63 conv2d_22\n",
      "64 batch_normalization_22\n",
      "65 activation_22\n",
      "66 conv2d_20\n",
      "67 conv2d_23\n",
      "68 batch_normalization_20\n",
      "69 batch_normalization_23\n",
      "70 activation_20\n",
      "71 activation_23\n",
      "72 conv2d_19\n",
      "73 conv2d_21\n",
      "74 conv2d_24\n",
      "75 batch_normalization_19\n",
      "76 batch_normalization_21\n",
      "77 batch_normalization_24\n",
      "78 activation_19\n",
      "79 activation_21\n",
      "80 activation_24\n",
      "81 block35_2_mixed\n",
      "82 block35_2_conv\n",
      "83 block35_2\n",
      "84 block35_2_ac\n",
      "85 conv2d_28\n",
      "86 batch_normalization_28\n",
      "87 activation_28\n",
      "88 conv2d_26\n",
      "89 conv2d_29\n",
      "90 batch_normalization_26\n",
      "91 batch_normalization_29\n",
      "92 activation_26\n",
      "93 activation_29\n",
      "94 conv2d_25\n",
      "95 conv2d_27\n",
      "96 conv2d_30\n",
      "97 batch_normalization_25\n",
      "98 batch_normalization_27\n",
      "99 batch_normalization_30\n",
      "100 activation_25\n",
      "101 activation_27\n",
      "102 activation_30\n",
      "103 block35_3_mixed\n",
      "104 block35_3_conv\n",
      "105 block35_3\n",
      "106 block35_3_ac\n",
      "107 conv2d_34\n",
      "108 batch_normalization_34\n",
      "109 activation_34\n",
      "110 conv2d_32\n",
      "111 conv2d_35\n",
      "112 batch_normalization_32\n",
      "113 batch_normalization_35\n",
      "114 activation_32\n",
      "115 activation_35\n",
      "116 conv2d_31\n",
      "117 conv2d_33\n",
      "118 conv2d_36\n",
      "119 batch_normalization_31\n",
      "120 batch_normalization_33\n",
      "121 batch_normalization_36\n",
      "122 activation_31\n",
      "123 activation_33\n",
      "124 activation_36\n",
      "125 block35_4_mixed\n",
      "126 block35_4_conv\n",
      "127 block35_4\n",
      "128 block35_4_ac\n",
      "129 conv2d_40\n",
      "130 batch_normalization_40\n",
      "131 activation_40\n",
      "132 conv2d_38\n",
      "133 conv2d_41\n",
      "134 batch_normalization_38\n",
      "135 batch_normalization_41\n",
      "136 activation_38\n",
      "137 activation_41\n",
      "138 conv2d_37\n",
      "139 conv2d_39\n",
      "140 conv2d_42\n",
      "141 batch_normalization_37\n",
      "142 batch_normalization_39\n",
      "143 batch_normalization_42\n",
      "144 activation_37\n",
      "145 activation_39\n",
      "146 activation_42\n",
      "147 block35_5_mixed\n",
      "148 block35_5_conv\n",
      "149 block35_5\n",
      "150 block35_5_ac\n",
      "151 conv2d_46\n",
      "152 batch_normalization_46\n",
      "153 activation_46\n",
      "154 conv2d_44\n",
      "155 conv2d_47\n",
      "156 batch_normalization_44\n",
      "157 batch_normalization_47\n",
      "158 activation_44\n",
      "159 activation_47\n",
      "160 conv2d_43\n",
      "161 conv2d_45\n",
      "162 conv2d_48\n",
      "163 batch_normalization_43\n",
      "164 batch_normalization_45\n",
      "165 batch_normalization_48\n",
      "166 activation_43\n",
      "167 activation_45\n",
      "168 activation_48\n",
      "169 block35_6_mixed\n",
      "170 block35_6_conv\n",
      "171 block35_6\n",
      "172 block35_6_ac\n",
      "173 conv2d_52\n",
      "174 batch_normalization_52\n",
      "175 activation_52\n",
      "176 conv2d_50\n",
      "177 conv2d_53\n",
      "178 batch_normalization_50\n",
      "179 batch_normalization_53\n",
      "180 activation_50\n",
      "181 activation_53\n",
      "182 conv2d_49\n",
      "183 conv2d_51\n",
      "184 conv2d_54\n",
      "185 batch_normalization_49\n",
      "186 batch_normalization_51\n",
      "187 batch_normalization_54\n",
      "188 activation_49\n",
      "189 activation_51\n",
      "190 activation_54\n",
      "191 block35_7_mixed\n",
      "192 block35_7_conv\n",
      "193 block35_7\n",
      "194 block35_7_ac\n",
      "195 conv2d_58\n",
      "196 batch_normalization_58\n",
      "197 activation_58\n",
      "198 conv2d_56\n",
      "199 conv2d_59\n",
      "200 batch_normalization_56\n",
      "201 batch_normalization_59\n",
      "202 activation_56\n",
      "203 activation_59\n",
      "204 conv2d_55\n",
      "205 conv2d_57\n",
      "206 conv2d_60\n",
      "207 batch_normalization_55\n",
      "208 batch_normalization_57\n",
      "209 batch_normalization_60\n",
      "210 activation_55\n",
      "211 activation_57\n",
      "212 activation_60\n",
      "213 block35_8_mixed\n",
      "214 block35_8_conv\n",
      "215 block35_8\n",
      "216 block35_8_ac\n",
      "217 conv2d_64\n",
      "218 batch_normalization_64\n",
      "219 activation_64\n",
      "220 conv2d_62\n",
      "221 conv2d_65\n",
      "222 batch_normalization_62\n",
      "223 batch_normalization_65\n",
      "224 activation_62\n",
      "225 activation_65\n",
      "226 conv2d_61\n",
      "227 conv2d_63\n",
      "228 conv2d_66\n",
      "229 batch_normalization_61\n",
      "230 batch_normalization_63\n",
      "231 batch_normalization_66\n",
      "232 activation_61\n",
      "233 activation_63\n",
      "234 activation_66\n",
      "235 block35_9_mixed\n",
      "236 block35_9_conv\n",
      "237 block35_9\n",
      "238 block35_9_ac\n",
      "239 conv2d_70\n",
      "240 batch_normalization_70\n",
      "241 activation_70\n",
      "242 conv2d_68\n",
      "243 conv2d_71\n",
      "244 batch_normalization_68\n",
      "245 batch_normalization_71\n",
      "246 activation_68\n",
      "247 activation_71\n",
      "248 conv2d_67\n",
      "249 conv2d_69\n",
      "250 conv2d_72\n",
      "251 batch_normalization_67\n",
      "252 batch_normalization_69\n",
      "253 batch_normalization_72\n",
      "254 activation_67\n",
      "255 activation_69\n",
      "256 activation_72\n",
      "257 block35_10_mixed\n",
      "258 block35_10_conv\n",
      "259 block35_10\n",
      "260 block35_10_ac\n",
      "261 conv2d_74\n",
      "262 batch_normalization_74\n",
      "263 activation_74\n",
      "264 conv2d_75\n",
      "265 batch_normalization_75\n",
      "266 activation_75\n",
      "267 conv2d_73\n",
      "268 conv2d_76\n",
      "269 batch_normalization_73\n",
      "270 batch_normalization_76\n",
      "271 activation_73\n",
      "272 activation_76\n",
      "273 max_pooling2d_3\n",
      "274 mixed_6a\n",
      "275 conv2d_78\n",
      "276 batch_normalization_78\n",
      "277 activation_78\n",
      "278 conv2d_79\n",
      "279 batch_normalization_79\n",
      "280 activation_79\n",
      "281 conv2d_77\n",
      "282 conv2d_80\n",
      "283 batch_normalization_77\n",
      "284 batch_normalization_80\n",
      "285 activation_77\n",
      "286 activation_80\n",
      "287 block17_1_mixed\n",
      "288 block17_1_conv\n",
      "289 block17_1\n",
      "290 block17_1_ac\n",
      "291 conv2d_82\n",
      "292 batch_normalization_82\n",
      "293 activation_82\n",
      "294 conv2d_83\n",
      "295 batch_normalization_83\n",
      "296 activation_83\n",
      "297 conv2d_81\n",
      "298 conv2d_84\n",
      "299 batch_normalization_81\n",
      "300 batch_normalization_84\n",
      "301 activation_81\n",
      "302 activation_84\n",
      "303 block17_2_mixed\n",
      "304 block17_2_conv\n",
      "305 block17_2\n",
      "306 block17_2_ac\n",
      "307 conv2d_86\n",
      "308 batch_normalization_86\n",
      "309 activation_86\n",
      "310 conv2d_87\n",
      "311 batch_normalization_87\n",
      "312 activation_87\n",
      "313 conv2d_85\n",
      "314 conv2d_88\n",
      "315 batch_normalization_85\n",
      "316 batch_normalization_88\n",
      "317 activation_85\n",
      "318 activation_88\n",
      "319 block17_3_mixed\n",
      "320 block17_3_conv\n",
      "321 block17_3\n",
      "322 block17_3_ac\n",
      "323 conv2d_90\n",
      "324 batch_normalization_90\n",
      "325 activation_90\n",
      "326 conv2d_91\n",
      "327 batch_normalization_91\n",
      "328 activation_91\n",
      "329 conv2d_89\n",
      "330 conv2d_92\n",
      "331 batch_normalization_89\n",
      "332 batch_normalization_92\n",
      "333 activation_89\n",
      "334 activation_92\n",
      "335 block17_4_mixed\n",
      "336 block17_4_conv\n",
      "337 block17_4\n",
      "338 block17_4_ac\n",
      "339 conv2d_94\n",
      "340 batch_normalization_94\n",
      "341 activation_94\n",
      "342 conv2d_95\n",
      "343 batch_normalization_95\n",
      "344 activation_95\n",
      "345 conv2d_93\n",
      "346 conv2d_96\n",
      "347 batch_normalization_93\n",
      "348 batch_normalization_96\n",
      "349 activation_93\n",
      "350 activation_96\n",
      "351 block17_5_mixed\n",
      "352 block17_5_conv\n",
      "353 block17_5\n",
      "354 block17_5_ac\n",
      "355 conv2d_98\n",
      "356 batch_normalization_98\n",
      "357 activation_98\n",
      "358 conv2d_99\n",
      "359 batch_normalization_99\n",
      "360 activation_99\n",
      "361 conv2d_97\n",
      "362 conv2d_100\n",
      "363 batch_normalization_97\n",
      "364 batch_normalization_100\n",
      "365 activation_97\n",
      "366 activation_100\n",
      "367 block17_6_mixed\n",
      "368 block17_6_conv\n",
      "369 block17_6\n",
      "370 block17_6_ac\n",
      "371 conv2d_102\n",
      "372 batch_normalization_102\n",
      "373 activation_102\n",
      "374 conv2d_103\n",
      "375 batch_normalization_103\n",
      "376 activation_103\n",
      "377 conv2d_101\n",
      "378 conv2d_104\n",
      "379 batch_normalization_101\n",
      "380 batch_normalization_104\n",
      "381 activation_101\n",
      "382 activation_104\n",
      "383 block17_7_mixed\n",
      "384 block17_7_conv\n",
      "385 block17_7\n",
      "386 block17_7_ac\n",
      "387 conv2d_106\n",
      "388 batch_normalization_106\n",
      "389 activation_106\n",
      "390 conv2d_107\n",
      "391 batch_normalization_107\n",
      "392 activation_107\n",
      "393 conv2d_105\n",
      "394 conv2d_108\n",
      "395 batch_normalization_105\n",
      "396 batch_normalization_108\n",
      "397 activation_105\n",
      "398 activation_108\n",
      "399 block17_8_mixed\n",
      "400 block17_8_conv\n",
      "401 block17_8\n",
      "402 block17_8_ac\n",
      "403 conv2d_110\n",
      "404 batch_normalization_110\n",
      "405 activation_110\n",
      "406 conv2d_111\n",
      "407 batch_normalization_111\n",
      "408 activation_111\n",
      "409 conv2d_109\n",
      "410 conv2d_112\n",
      "411 batch_normalization_109\n",
      "412 batch_normalization_112\n",
      "413 activation_109\n",
      "414 activation_112\n",
      "415 block17_9_mixed\n",
      "416 block17_9_conv\n",
      "417 block17_9\n",
      "418 block17_9_ac\n",
      "419 conv2d_114\n",
      "420 batch_normalization_114\n",
      "421 activation_114\n",
      "422 conv2d_115\n",
      "423 batch_normalization_115\n",
      "424 activation_115\n",
      "425 conv2d_113\n",
      "426 conv2d_116\n",
      "427 batch_normalization_113\n",
      "428 batch_normalization_116\n",
      "429 activation_113\n",
      "430 activation_116\n",
      "431 block17_10_mixed\n",
      "432 block17_10_conv\n",
      "433 block17_10\n",
      "434 block17_10_ac\n",
      "435 conv2d_118\n",
      "436 batch_normalization_118\n",
      "437 activation_118\n",
      "438 conv2d_119\n",
      "439 batch_normalization_119\n",
      "440 activation_119\n",
      "441 conv2d_117\n",
      "442 conv2d_120\n",
      "443 batch_normalization_117\n",
      "444 batch_normalization_120\n",
      "445 activation_117\n",
      "446 activation_120\n",
      "447 block17_11_mixed\n",
      "448 block17_11_conv\n",
      "449 block17_11\n",
      "450 block17_11_ac\n",
      "451 conv2d_122\n",
      "452 batch_normalization_122\n",
      "453 activation_122\n",
      "454 conv2d_123\n",
      "455 batch_normalization_123\n",
      "456 activation_123\n",
      "457 conv2d_121\n",
      "458 conv2d_124\n",
      "459 batch_normalization_121\n",
      "460 batch_normalization_124\n",
      "461 activation_121\n",
      "462 activation_124\n",
      "463 block17_12_mixed\n",
      "464 block17_12_conv\n",
      "465 block17_12\n",
      "466 block17_12_ac\n",
      "467 conv2d_126\n",
      "468 batch_normalization_126\n",
      "469 activation_126\n",
      "470 conv2d_127\n",
      "471 batch_normalization_127\n",
      "472 activation_127\n",
      "473 conv2d_125\n",
      "474 conv2d_128\n",
      "475 batch_normalization_125\n",
      "476 batch_normalization_128\n",
      "477 activation_125\n",
      "478 activation_128\n",
      "479 block17_13_mixed\n",
      "480 block17_13_conv\n",
      "481 block17_13\n",
      "482 block17_13_ac\n",
      "483 conv2d_130\n",
      "484 batch_normalization_130\n",
      "485 activation_130\n",
      "486 conv2d_131\n",
      "487 batch_normalization_131\n",
      "488 activation_131\n",
      "489 conv2d_129\n",
      "490 conv2d_132\n",
      "491 batch_normalization_129\n",
      "492 batch_normalization_132\n",
      "493 activation_129\n",
      "494 activation_132\n",
      "495 block17_14_mixed\n",
      "496 block17_14_conv\n",
      "497 block17_14\n",
      "498 block17_14_ac\n",
      "499 conv2d_134\n",
      "500 batch_normalization_134\n",
      "501 activation_134\n",
      "502 conv2d_135\n",
      "503 batch_normalization_135\n",
      "504 activation_135\n",
      "505 conv2d_133\n",
      "506 conv2d_136\n",
      "507 batch_normalization_133\n",
      "508 batch_normalization_136\n",
      "509 activation_133\n",
      "510 activation_136\n",
      "511 block17_15_mixed\n",
      "512 block17_15_conv\n",
      "513 block17_15\n",
      "514 block17_15_ac\n",
      "515 conv2d_138\n",
      "516 batch_normalization_138\n",
      "517 activation_138\n",
      "518 conv2d_139\n",
      "519 batch_normalization_139\n",
      "520 activation_139\n",
      "521 conv2d_137\n",
      "522 conv2d_140\n",
      "523 batch_normalization_137\n",
      "524 batch_normalization_140\n",
      "525 activation_137\n",
      "526 activation_140\n",
      "527 block17_16_mixed\n",
      "528 block17_16_conv\n",
      "529 block17_16\n",
      "530 block17_16_ac\n",
      "531 conv2d_142\n",
      "532 batch_normalization_142\n",
      "533 activation_142\n",
      "534 conv2d_143\n",
      "535 batch_normalization_143\n",
      "536 activation_143\n",
      "537 conv2d_141\n",
      "538 conv2d_144\n",
      "539 batch_normalization_141\n",
      "540 batch_normalization_144\n",
      "541 activation_141\n",
      "542 activation_144\n",
      "543 block17_17_mixed\n",
      "544 block17_17_conv\n",
      "545 block17_17\n",
      "546 block17_17_ac\n",
      "547 conv2d_146\n",
      "548 batch_normalization_146\n",
      "549 activation_146\n",
      "550 conv2d_147\n",
      "551 batch_normalization_147\n",
      "552 activation_147\n",
      "553 conv2d_145\n",
      "554 conv2d_148\n",
      "555 batch_normalization_145\n",
      "556 batch_normalization_148\n",
      "557 activation_145\n",
      "558 activation_148\n",
      "559 block17_18_mixed\n",
      "560 block17_18_conv\n",
      "561 block17_18\n",
      "562 block17_18_ac\n",
      "563 conv2d_150\n",
      "564 batch_normalization_150\n",
      "565 activation_150\n",
      "566 conv2d_151\n",
      "567 batch_normalization_151\n",
      "568 activation_151\n",
      "569 conv2d_149\n",
      "570 conv2d_152\n",
      "571 batch_normalization_149\n",
      "572 batch_normalization_152\n",
      "573 activation_149\n",
      "574 activation_152\n",
      "575 block17_19_mixed\n",
      "576 block17_19_conv\n",
      "577 block17_19\n",
      "578 block17_19_ac\n",
      "579 conv2d_154\n",
      "580 batch_normalization_154\n",
      "581 activation_154\n",
      "582 conv2d_155\n",
      "583 batch_normalization_155\n",
      "584 activation_155\n",
      "585 conv2d_153\n",
      "586 conv2d_156\n",
      "587 batch_normalization_153\n",
      "588 batch_normalization_156\n",
      "589 activation_153\n",
      "590 activation_156\n",
      "591 block17_20_mixed\n",
      "592 block17_20_conv\n",
      "593 block17_20\n",
      "594 block17_20_ac\n",
      "595 conv2d_161\n",
      "596 batch_normalization_161\n",
      "597 activation_161\n",
      "598 conv2d_157\n",
      "599 conv2d_159\n",
      "600 conv2d_162\n",
      "601 batch_normalization_157\n",
      "602 batch_normalization_159\n",
      "603 batch_normalization_162\n",
      "604 activation_157\n",
      "605 activation_159\n",
      "606 activation_162\n",
      "607 conv2d_158\n",
      "608 conv2d_160\n",
      "609 conv2d_163\n",
      "610 batch_normalization_158\n",
      "611 batch_normalization_160\n",
      "612 batch_normalization_163\n",
      "613 activation_158\n",
      "614 activation_160\n",
      "615 activation_163\n",
      "616 max_pooling2d_4\n",
      "617 mixed_7a\n",
      "618 conv2d_165\n",
      "619 batch_normalization_165\n",
      "620 activation_165\n",
      "621 conv2d_166\n",
      "622 batch_normalization_166\n",
      "623 activation_166\n",
      "624 conv2d_164\n",
      "625 conv2d_167\n",
      "626 batch_normalization_164\n",
      "627 batch_normalization_167\n",
      "628 activation_164\n",
      "629 activation_167\n",
      "630 block8_1_mixed\n",
      "631 block8_1_conv\n",
      "632 block8_1\n",
      "633 block8_1_ac\n",
      "634 conv2d_169\n",
      "635 batch_normalization_169\n",
      "636 activation_169\n",
      "637 conv2d_170\n",
      "638 batch_normalization_170\n",
      "639 activation_170\n",
      "640 conv2d_168\n",
      "641 conv2d_171\n",
      "642 batch_normalization_168\n",
      "643 batch_normalization_171\n",
      "644 activation_168\n",
      "645 activation_171\n",
      "646 block8_2_mixed\n",
      "647 block8_2_conv\n",
      "648 block8_2\n",
      "649 block8_2_ac\n",
      "650 conv2d_173\n",
      "651 batch_normalization_173\n",
      "652 activation_173\n",
      "653 conv2d_174\n",
      "654 batch_normalization_174\n",
      "655 activation_174\n",
      "656 conv2d_172\n",
      "657 conv2d_175\n",
      "658 batch_normalization_172\n",
      "659 batch_normalization_175\n",
      "660 activation_172\n",
      "661 activation_175\n",
      "662 block8_3_mixed\n",
      "663 block8_3_conv\n",
      "664 block8_3\n",
      "665 block8_3_ac\n",
      "666 conv2d_177\n",
      "667 batch_normalization_177\n",
      "668 activation_177\n",
      "669 conv2d_178\n",
      "670 batch_normalization_178\n",
      "671 activation_178\n",
      "672 conv2d_176\n",
      "673 conv2d_179\n",
      "674 batch_normalization_176\n",
      "675 batch_normalization_179\n",
      "676 activation_176\n",
      "677 activation_179\n",
      "678 block8_4_mixed\n",
      "679 block8_4_conv\n",
      "680 block8_4\n",
      "681 block8_4_ac\n",
      "682 conv2d_181\n",
      "683 batch_normalization_181\n",
      "684 activation_181\n",
      "685 conv2d_182\n",
      "686 batch_normalization_182\n",
      "687 activation_182\n",
      "688 conv2d_180\n",
      "689 conv2d_183\n",
      "690 batch_normalization_180\n",
      "691 batch_normalization_183\n",
      "692 activation_180\n",
      "693 activation_183\n",
      "694 block8_5_mixed\n",
      "695 block8_5_conv\n",
      "696 block8_5\n",
      "697 block8_5_ac\n",
      "698 conv2d_185\n",
      "699 batch_normalization_185\n",
      "700 activation_185\n",
      "701 conv2d_186\n",
      "702 batch_normalization_186\n",
      "703 activation_186\n",
      "704 conv2d_184\n",
      "705 conv2d_187\n",
      "706 batch_normalization_184\n",
      "707 batch_normalization_187\n",
      "708 activation_184\n",
      "709 activation_187\n",
      "710 block8_6_mixed\n",
      "711 block8_6_conv\n",
      "712 block8_6\n",
      "713 block8_6_ac\n",
      "714 conv2d_189\n",
      "715 batch_normalization_189\n",
      "716 activation_189\n",
      "717 conv2d_190\n",
      "718 batch_normalization_190\n",
      "719 activation_190\n",
      "720 conv2d_188\n",
      "721 conv2d_191\n",
      "722 batch_normalization_188\n",
      "723 batch_normalization_191\n",
      "724 activation_188\n",
      "725 activation_191\n",
      "726 block8_7_mixed\n",
      "727 block8_7_conv\n",
      "728 block8_7\n",
      "729 block8_7_ac\n",
      "730 conv2d_193\n",
      "731 batch_normalization_193\n",
      "732 activation_193\n",
      "733 conv2d_194\n",
      "734 batch_normalization_194\n",
      "735 activation_194\n",
      "736 conv2d_192\n",
      "737 conv2d_195\n",
      "738 batch_normalization_192\n",
      "739 batch_normalization_195\n",
      "740 activation_192\n",
      "741 activation_195\n",
      "742 block8_8_mixed\n",
      "743 block8_8_conv\n",
      "744 block8_8\n",
      "745 block8_8_ac\n",
      "746 conv2d_197\n",
      "747 batch_normalization_197\n",
      "748 activation_197\n",
      "749 conv2d_198\n",
      "750 batch_normalization_198\n",
      "751 activation_198\n",
      "752 conv2d_196\n",
      "753 conv2d_199\n",
      "754 batch_normalization_196\n",
      "755 batch_normalization_199\n",
      "756 activation_196\n",
      "757 activation_199\n",
      "758 block8_9_mixed\n",
      "759 block8_9_conv\n",
      "760 block8_9\n",
      "761 block8_9_ac\n",
      "762 conv2d_201\n",
      "763 batch_normalization_201\n",
      "764 activation_201\n",
      "765 conv2d_202\n",
      "766 batch_normalization_202\n",
      "767 activation_202\n",
      "768 conv2d_200\n",
      "769 conv2d_203\n",
      "770 batch_normalization_200\n",
      "771 batch_normalization_203\n",
      "772 activation_200\n",
      "773 activation_203\n",
      "774 block8_10_mixed\n",
      "775 block8_10_conv\n",
      "776 block8_10\n",
      "777 conv_7b\n",
      "778 conv_7b_bn\n",
      "779 conv_7b_ac\n"
     ]
    }
   ],
   "source": [
    "for i, layer in enumerate(base_model.layers):\n",
    "    print(i, layer.name)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 10,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "<tf.Tensor 'mixed_6a/concat:0' shape=(?, 17, 17, 1088) dtype=float32>"
      ]
     },
     "execution_count": 10,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "base_model.get_layer('mixed_6a').output"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 11,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "WARNING:tensorflow:From /usr/local/lib/python3.6/dist-packages/keras/backend/tensorflow_backend.py:3445: calling dropout (from tensorflow.python.ops.nn_ops) with keep_prob is deprecated and will be removed in a future version.\n",
      "Instructions for updating:\n",
      "Please use `rate` instead of `keep_prob`. Rate should be set to `rate = 1 - keep_prob`.\n",
      "__________________________________________________________________________________________________\n",
      "Layer (type)                    Output Shape         Param #     Connected to                     \n",
      "==================================================================================================\n",
      "input_1 (InputLayer)            (None, 299, 299, 3)  0                                            \n",
      "__________________________________________________________________________________________________\n",
      "conv2d_1 (Conv2D)               (None, 149, 149, 32) 864         input_1[0][0]                    \n",
      "__________________________________________________________________________________________________\n",
      "batch_normalization_1 (BatchNor (None, 149, 149, 32) 96          conv2d_1[0][0]                   \n",
      "__________________________________________________________________________________________________\n",
      "activation_1 (Activation)       (None, 149, 149, 32) 0           batch_normalization_1[0][0]      \n",
      "__________________________________________________________________________________________________\n",
      "conv2d_2 (Conv2D)               (None, 147, 147, 32) 9216        activation_1[0][0]               \n",
      "__________________________________________________________________________________________________\n",
      "batch_normalization_2 (BatchNor (None, 147, 147, 32) 96          conv2d_2[0][0]                   \n",
      "__________________________________________________________________________________________________\n",
      "activation_2 (Activation)       (None, 147, 147, 32) 0           batch_normalization_2[0][0]      \n",
      "__________________________________________________________________________________________________\n",
      "conv2d_3 (Conv2D)               (None, 147, 147, 64) 18432       activation_2[0][0]               \n",
      "__________________________________________________________________________________________________\n",
      "batch_normalization_3 (BatchNor (None, 147, 147, 64) 192         conv2d_3[0][0]                   \n",
      "__________________________________________________________________________________________________\n",
      "activation_3 (Activation)       (None, 147, 147, 64) 0           batch_normalization_3[0][0]      \n",
      "__________________________________________________________________________________________________\n",
      "max_pooling2d_1 (MaxPooling2D)  (None, 73, 73, 64)   0           activation_3[0][0]               \n",
      "__________________________________________________________________________________________________\n",
      "conv2d_4 (Conv2D)               (None, 73, 73, 80)   5120        max_pooling2d_1[0][0]            \n",
      "__________________________________________________________________________________________________\n",
      "batch_normalization_4 (BatchNor (None, 73, 73, 80)   240         conv2d_4[0][0]                   \n",
      "__________________________________________________________________________________________________\n",
      "activation_4 (Activation)       (None, 73, 73, 80)   0           batch_normalization_4[0][0]      \n",
      "__________________________________________________________________________________________________\n",
      "conv2d_5 (Conv2D)               (None, 71, 71, 192)  138240      activation_4[0][0]               \n",
      "__________________________________________________________________________________________________\n",
      "batch_normalization_5 (BatchNor (None, 71, 71, 192)  576         conv2d_5[0][0]                   \n",
      "__________________________________________________________________________________________________\n",
      "activation_5 (Activation)       (None, 71, 71, 192)  0           batch_normalization_5[0][0]      \n",
      "__________________________________________________________________________________________________\n",
      "max_pooling2d_2 (MaxPooling2D)  (None, 35, 35, 192)  0           activation_5[0][0]               \n",
      "__________________________________________________________________________________________________\n",
      "conv2d_9 (Conv2D)               (None, 35, 35, 64)   12288       max_pooling2d_2[0][0]            \n",
      "__________________________________________________________________________________________________\n",
      "batch_normalization_9 (BatchNor (None, 35, 35, 64)   192         conv2d_9[0][0]                   \n",
      "__________________________________________________________________________________________________\n",
      "activation_9 (Activation)       (None, 35, 35, 64)   0           batch_normalization_9[0][0]      \n",
      "__________________________________________________________________________________________________\n",
      "conv2d_7 (Conv2D)               (None, 35, 35, 48)   9216        max_pooling2d_2[0][0]            \n",
      "__________________________________________________________________________________________________\n",
      "conv2d_10 (Conv2D)              (None, 35, 35, 96)   55296       activation_9[0][0]               \n",
      "__________________________________________________________________________________________________\n",
      "batch_normalization_7 (BatchNor (None, 35, 35, 48)   144         conv2d_7[0][0]                   \n",
      "__________________________________________________________________________________________________\n",
      "batch_normalization_10 (BatchNo (None, 35, 35, 96)   288         conv2d_10[0][0]                  \n",
      "__________________________________________________________________________________________________\n",
      "activation_7 (Activation)       (None, 35, 35, 48)   0           batch_normalization_7[0][0]      \n",
      "__________________________________________________________________________________________________\n",
      "activation_10 (Activation)      (None, 35, 35, 96)   0           batch_normalization_10[0][0]     \n",
      "__________________________________________________________________________________________________\n",
      "average_pooling2d_1 (AveragePoo (None, 35, 35, 192)  0           max_pooling2d_2[0][0]            \n",
      "__________________________________________________________________________________________________\n",
      "conv2d_6 (Conv2D)               (None, 35, 35, 96)   18432       max_pooling2d_2[0][0]            \n",
      "__________________________________________________________________________________________________\n",
      "conv2d_8 (Conv2D)               (None, 35, 35, 64)   76800       activation_7[0][0]               \n",
      "__________________________________________________________________________________________________\n",
      "conv2d_11 (Conv2D)              (None, 35, 35, 96)   82944       activation_10[0][0]              \n",
      "__________________________________________________________________________________________________\n",
      "conv2d_12 (Conv2D)              (None, 35, 35, 64)   12288       average_pooling2d_1[0][0]        \n",
      "__________________________________________________________________________________________________\n",
      "batch_normalization_6 (BatchNor (None, 35, 35, 96)   288         conv2d_6[0][0]                   \n",
      "__________________________________________________________________________________________________\n",
      "batch_normalization_8 (BatchNor (None, 35, 35, 64)   192         conv2d_8[0][0]                   \n",
      "__________________________________________________________________________________________________\n",
      "batch_normalization_11 (BatchNo (None, 35, 35, 96)   288         conv2d_11[0][0]                  \n",
      "__________________________________________________________________________________________________\n",
      "batch_normalization_12 (BatchNo (None, 35, 35, 64)   192         conv2d_12[0][0]                  \n",
      "__________________________________________________________________________________________________\n",
      "activation_6 (Activation)       (None, 35, 35, 96)   0           batch_normalization_6[0][0]      \n",
      "__________________________________________________________________________________________________\n",
      "activation_8 (Activation)       (None, 35, 35, 64)   0           batch_normalization_8[0][0]      \n",
      "__________________________________________________________________________________________________\n",
      "activation_11 (Activation)      (None, 35, 35, 96)   0           batch_normalization_11[0][0]     \n",
      "__________________________________________________________________________________________________\n",
      "activation_12 (Activation)      (None, 35, 35, 64)   0           batch_normalization_12[0][0]     \n",
      "__________________________________________________________________________________________________\n",
      "mixed_5b (Concatenate)          (None, 35, 35, 320)  0           activation_6[0][0]               \n",
      "                                                                 activation_8[0][0]               \n",
      "                                                                 activation_11[0][0]              \n",
      "                                                                 activation_12[0][0]              \n",
      "__________________________________________________________________________________________________\n",
      "conv2d_16 (Conv2D)              (None, 35, 35, 32)   10240       mixed_5b[0][0]                   \n",
      "__________________________________________________________________________________________________\n",
      "batch_normalization_16 (BatchNo (None, 35, 35, 32)   96          conv2d_16[0][0]                  \n",
      "__________________________________________________________________________________________________\n",
      "activation_16 (Activation)      (None, 35, 35, 32)   0           batch_normalization_16[0][0]     \n",
      "__________________________________________________________________________________________________\n",
      "conv2d_14 (Conv2D)              (None, 35, 35, 32)   10240       mixed_5b[0][0]                   \n",
      "__________________________________________________________________________________________________\n",
      "conv2d_17 (Conv2D)              (None, 35, 35, 48)   13824       activation_16[0][0]              \n",
      "__________________________________________________________________________________________________\n",
      "batch_normalization_14 (BatchNo (None, 35, 35, 32)   96          conv2d_14[0][0]                  \n",
      "__________________________________________________________________________________________________\n",
      "batch_normalization_17 (BatchNo (None, 35, 35, 48)   144         conv2d_17[0][0]                  \n",
      "__________________________________________________________________________________________________\n",
      "activation_14 (Activation)      (None, 35, 35, 32)   0           batch_normalization_14[0][0]     \n",
      "__________________________________________________________________________________________________\n",
      "activation_17 (Activation)      (None, 35, 35, 48)   0           batch_normalization_17[0][0]     \n",
      "__________________________________________________________________________________________________\n",
      "conv2d_13 (Conv2D)              (None, 35, 35, 32)   10240       mixed_5b[0][0]                   \n",
      "__________________________________________________________________________________________________\n",
      "conv2d_15 (Conv2D)              (None, 35, 35, 32)   9216        activation_14[0][0]              \n",
      "__________________________________________________________________________________________________\n",
      "conv2d_18 (Conv2D)              (None, 35, 35, 64)   27648       activation_17[0][0]              \n",
      "__________________________________________________________________________________________________\n",
      "batch_normalization_13 (BatchNo (None, 35, 35, 32)   96          conv2d_13[0][0]                  \n",
      "__________________________________________________________________________________________________\n",
      "batch_normalization_15 (BatchNo (None, 35, 35, 32)   96          conv2d_15[0][0]                  \n",
      "__________________________________________________________________________________________________\n",
      "batch_normalization_18 (BatchNo (None, 35, 35, 64)   192         conv2d_18[0][0]                  \n",
      "__________________________________________________________________________________________________\n",
      "activation_13 (Activation)      (None, 35, 35, 32)   0           batch_normalization_13[0][0]     \n",
      "__________________________________________________________________________________________________\n",
      "activation_15 (Activation)      (None, 35, 35, 32)   0           batch_normalization_15[0][0]     \n",
      "__________________________________________________________________________________________________\n",
      "activation_18 (Activation)      (None, 35, 35, 64)   0           batch_normalization_18[0][0]     \n",
      "__________________________________________________________________________________________________\n",
      "block35_1_mixed (Concatenate)   (None, 35, 35, 128)  0           activation_13[0][0]              \n",
      "                                                                 activation_15[0][0]              \n",
      "                                                                 activation_18[0][0]              \n",
      "__________________________________________________________________________________________________\n",
      "block35_1_conv (Conv2D)         (None, 35, 35, 320)  41280       block35_1_mixed[0][0]            \n",
      "__________________________________________________________________________________________________\n",
      "block35_1 (Lambda)              (None, 35, 35, 320)  0           mixed_5b[0][0]                   \n",
      "                                                                 block35_1_conv[0][0]             \n",
      "__________________________________________________________________________________________________\n",
      "block35_1_ac (Activation)       (None, 35, 35, 320)  0           block35_1[0][0]                  \n",
      "__________________________________________________________________________________________________\n",
      "conv2d_22 (Conv2D)              (None, 35, 35, 32)   10240       block35_1_ac[0][0]               \n",
      "__________________________________________________________________________________________________\n",
      "batch_normalization_22 (BatchNo (None, 35, 35, 32)   96          conv2d_22[0][0]                  \n",
      "__________________________________________________________________________________________________\n",
      "activation_22 (Activation)      (None, 35, 35, 32)   0           batch_normalization_22[0][0]     \n",
      "__________________________________________________________________________________________________\n",
      "conv2d_20 (Conv2D)              (None, 35, 35, 32)   10240       block35_1_ac[0][0]               \n",
      "__________________________________________________________________________________________________\n",
      "conv2d_23 (Conv2D)              (None, 35, 35, 48)   13824       activation_22[0][0]              \n",
      "__________________________________________________________________________________________________\n",
      "batch_normalization_20 (BatchNo (None, 35, 35, 32)   96          conv2d_20[0][0]                  \n",
      "__________________________________________________________________________________________________\n",
      "batch_normalization_23 (BatchNo (None, 35, 35, 48)   144         conv2d_23[0][0]                  \n",
      "__________________________________________________________________________________________________\n",
      "activation_20 (Activation)      (None, 35, 35, 32)   0           batch_normalization_20[0][0]     \n",
      "__________________________________________________________________________________________________\n",
      "activation_23 (Activation)      (None, 35, 35, 48)   0           batch_normalization_23[0][0]     \n",
      "__________________________________________________________________________________________________\n",
      "conv2d_19 (Conv2D)              (None, 35, 35, 32)   10240       block35_1_ac[0][0]               \n",
      "__________________________________________________________________________________________________\n",
      "conv2d_21 (Conv2D)              (None, 35, 35, 32)   9216        activation_20[0][0]              \n",
      "__________________________________________________________________________________________________\n",
      "conv2d_24 (Conv2D)              (None, 35, 35, 64)   27648       activation_23[0][0]              \n",
      "__________________________________________________________________________________________________\n",
      "batch_normalization_19 (BatchNo (None, 35, 35, 32)   96          conv2d_19[0][0]                  \n",
      "__________________________________________________________________________________________________\n",
      "batch_normalization_21 (BatchNo (None, 35, 35, 32)   96          conv2d_21[0][0]                  \n",
      "__________________________________________________________________________________________________\n",
      "batch_normalization_24 (BatchNo (None, 35, 35, 64)   192         conv2d_24[0][0]                  \n",
      "__________________________________________________________________________________________________\n",
      "activation_19 (Activation)      (None, 35, 35, 32)   0           batch_normalization_19[0][0]     \n",
      "__________________________________________________________________________________________________\n",
      "activation_21 (Activation)      (None, 35, 35, 32)   0           batch_normalization_21[0][0]     \n",
      "__________________________________________________________________________________________________\n",
      "activation_24 (Activation)      (None, 35, 35, 64)   0           batch_normalization_24[0][0]     \n",
      "__________________________________________________________________________________________________\n",
      "block35_2_mixed (Concatenate)   (None, 35, 35, 128)  0           activation_19[0][0]              \n",
      "                                                                 activation_21[0][0]              \n",
      "                                                                 activation_24[0][0]              \n",
      "__________________________________________________________________________________________________\n",
      "block35_2_conv (Conv2D)         (None, 35, 35, 320)  41280       block35_2_mixed[0][0]            \n",
      "__________________________________________________________________________________________________\n",
      "block35_2 (Lambda)              (None, 35, 35, 320)  0           block35_1_ac[0][0]               \n",
      "                                                                 block35_2_conv[0][0]             \n",
      "__________________________________________________________________________________________________\n",
      "block35_2_ac (Activation)       (None, 35, 35, 320)  0           block35_2[0][0]                  \n",
      "__________________________________________________________________________________________________\n",
      "conv2d_28 (Conv2D)              (None, 35, 35, 32)   10240       block35_2_ac[0][0]               \n",
      "__________________________________________________________________________________________________\n",
      "batch_normalization_28 (BatchNo (None, 35, 35, 32)   96          conv2d_28[0][0]                  \n",
      "__________________________________________________________________________________________________\n",
      "activation_28 (Activation)      (None, 35, 35, 32)   0           batch_normalization_28[0][0]     \n",
      "__________________________________________________________________________________________________\n",
      "conv2d_26 (Conv2D)              (None, 35, 35, 32)   10240       block35_2_ac[0][0]               \n",
      "__________________________________________________________________________________________________\n",
      "conv2d_29 (Conv2D)              (None, 35, 35, 48)   13824       activation_28[0][0]              \n",
      "__________________________________________________________________________________________________\n",
      "batch_normalization_26 (BatchNo (None, 35, 35, 32)   96          conv2d_26[0][0]                  \n",
      "__________________________________________________________________________________________________\n",
      "batch_normalization_29 (BatchNo (None, 35, 35, 48)   144         conv2d_29[0][0]                  \n",
      "__________________________________________________________________________________________________\n",
      "activation_26 (Activation)      (None, 35, 35, 32)   0           batch_normalization_26[0][0]     \n",
      "__________________________________________________________________________________________________\n",
      "activation_29 (Activation)      (None, 35, 35, 48)   0           batch_normalization_29[0][0]     \n",
      "__________________________________________________________________________________________________\n",
      "conv2d_25 (Conv2D)              (None, 35, 35, 32)   10240       block35_2_ac[0][0]               \n",
      "__________________________________________________________________________________________________\n",
      "conv2d_27 (Conv2D)              (None, 35, 35, 32)   9216        activation_26[0][0]              \n",
      "__________________________________________________________________________________________________\n",
      "conv2d_30 (Conv2D)              (None, 35, 35, 64)   27648       activation_29[0][0]              \n",
      "__________________________________________________________________________________________________\n",
      "batch_normalization_25 (BatchNo (None, 35, 35, 32)   96          conv2d_25[0][0]                  \n",
      "__________________________________________________________________________________________________\n",
      "batch_normalization_27 (BatchNo (None, 35, 35, 32)   96          conv2d_27[0][0]                  \n",
      "__________________________________________________________________________________________________\n",
      "batch_normalization_30 (BatchNo (None, 35, 35, 64)   192         conv2d_30[0][0]                  \n",
      "__________________________________________________________________________________________________\n",
      "activation_25 (Activation)      (None, 35, 35, 32)   0           batch_normalization_25[0][0]     \n",
      "__________________________________________________________________________________________________\n",
      "activation_27 (Activation)      (None, 35, 35, 32)   0           batch_normalization_27[0][0]     \n",
      "__________________________________________________________________________________________________\n",
      "activation_30 (Activation)      (None, 35, 35, 64)   0           batch_normalization_30[0][0]     \n",
      "__________________________________________________________________________________________________\n",
      "block35_3_mixed (Concatenate)   (None, 35, 35, 128)  0           activation_25[0][0]              \n",
      "                                                                 activation_27[0][0]              \n",
      "                                                                 activation_30[0][0]              \n",
      "__________________________________________________________________________________________________\n",
      "block35_3_conv (Conv2D)         (None, 35, 35, 320)  41280       block35_3_mixed[0][0]            \n",
      "__________________________________________________________________________________________________\n",
      "block35_3 (Lambda)              (None, 35, 35, 320)  0           block35_2_ac[0][0]               \n",
      "                                                                 block35_3_conv[0][0]             \n",
      "__________________________________________________________________________________________________\n",
      "block35_3_ac (Activation)       (None, 35, 35, 320)  0           block35_3[0][0]                  \n",
      "__________________________________________________________________________________________________\n",
      "conv2d_34 (Conv2D)              (None, 35, 35, 32)   10240       block35_3_ac[0][0]               \n",
      "__________________________________________________________________________________________________\n",
      "batch_normalization_34 (BatchNo (None, 35, 35, 32)   96          conv2d_34[0][0]                  \n",
      "__________________________________________________________________________________________________\n",
      "activation_34 (Activation)      (None, 35, 35, 32)   0           batch_normalization_34[0][0]     \n",
      "__________________________________________________________________________________________________\n",
      "conv2d_32 (Conv2D)              (None, 35, 35, 32)   10240       block35_3_ac[0][0]               \n",
      "__________________________________________________________________________________________________\n",
      "conv2d_35 (Conv2D)              (None, 35, 35, 48)   13824       activation_34[0][0]              \n",
      "__________________________________________________________________________________________________\n",
      "batch_normalization_32 (BatchNo (None, 35, 35, 32)   96          conv2d_32[0][0]                  \n",
      "__________________________________________________________________________________________________\n",
      "batch_normalization_35 (BatchNo (None, 35, 35, 48)   144         conv2d_35[0][0]                  \n",
      "__________________________________________________________________________________________________\n",
      "activation_32 (Activation)      (None, 35, 35, 32)   0           batch_normalization_32[0][0]     \n",
      "__________________________________________________________________________________________________\n",
      "activation_35 (Activation)      (None, 35, 35, 48)   0           batch_normalization_35[0][0]     \n",
      "__________________________________________________________________________________________________\n",
      "conv2d_31 (Conv2D)              (None, 35, 35, 32)   10240       block35_3_ac[0][0]               \n",
      "__________________________________________________________________________________________________\n",
      "conv2d_33 (Conv2D)              (None, 35, 35, 32)   9216        activation_32[0][0]              \n",
      "__________________________________________________________________________________________________\n",
      "conv2d_36 (Conv2D)              (None, 35, 35, 64)   27648       activation_35[0][0]              \n",
      "__________________________________________________________________________________________________\n",
      "batch_normalization_31 (BatchNo (None, 35, 35, 32)   96          conv2d_31[0][0]                  \n",
      "__________________________________________________________________________________________________\n",
      "batch_normalization_33 (BatchNo (None, 35, 35, 32)   96          conv2d_33[0][0]                  \n",
      "__________________________________________________________________________________________________\n",
      "batch_normalization_36 (BatchNo (None, 35, 35, 64)   192         conv2d_36[0][0]                  \n",
      "__________________________________________________________________________________________________\n",
      "activation_31 (Activation)      (None, 35, 35, 32)   0           batch_normalization_31[0][0]     \n",
      "__________________________________________________________________________________________________\n",
      "activation_33 (Activation)      (None, 35, 35, 32)   0           batch_normalization_33[0][0]     \n",
      "__________________________________________________________________________________________________\n",
      "activation_36 (Activation)      (None, 35, 35, 64)   0           batch_normalization_36[0][0]     \n",
      "__________________________________________________________________________________________________\n",
      "block35_4_mixed (Concatenate)   (None, 35, 35, 128)  0           activation_31[0][0]              \n",
      "                                                                 activation_33[0][0]              \n",
      "                                                                 activation_36[0][0]              \n",
      "__________________________________________________________________________________________________\n",
      "block35_4_conv (Conv2D)         (None, 35, 35, 320)  41280       block35_4_mixed[0][0]            \n",
      "__________________________________________________________________________________________________\n",
      "block35_4 (Lambda)              (None, 35, 35, 320)  0           block35_3_ac[0][0]               \n",
      "                                                                 block35_4_conv[0][0]             \n",
      "__________________________________________________________________________________________________\n",
      "block35_4_ac (Activation)       (None, 35, 35, 320)  0           block35_4[0][0]                  \n",
      "__________________________________________________________________________________________________\n",
      "conv2d_40 (Conv2D)              (None, 35, 35, 32)   10240       block35_4_ac[0][0]               \n",
      "__________________________________________________________________________________________________\n",
      "batch_normalization_40 (BatchNo (None, 35, 35, 32)   96          conv2d_40[0][0]                  \n",
      "__________________________________________________________________________________________________\n",
      "activation_40 (Activation)      (None, 35, 35, 32)   0           batch_normalization_40[0][0]     \n",
      "__________________________________________________________________________________________________\n",
      "conv2d_38 (Conv2D)              (None, 35, 35, 32)   10240       block35_4_ac[0][0]               \n",
      "__________________________________________________________________________________________________\n",
      "conv2d_41 (Conv2D)              (None, 35, 35, 48)   13824       activation_40[0][0]              \n",
      "__________________________________________________________________________________________________\n",
      "batch_normalization_38 (BatchNo (None, 35, 35, 32)   96          conv2d_38[0][0]                  \n",
      "__________________________________________________________________________________________________\n",
      "batch_normalization_41 (BatchNo (None, 35, 35, 48)   144         conv2d_41[0][0]                  \n",
      "__________________________________________________________________________________________________\n",
      "activation_38 (Activation)      (None, 35, 35, 32)   0           batch_normalization_38[0][0]     \n",
      "__________________________________________________________________________________________________\n",
      "activation_41 (Activation)      (None, 35, 35, 48)   0           batch_normalization_41[0][0]     \n",
      "__________________________________________________________________________________________________\n",
      "conv2d_37 (Conv2D)              (None, 35, 35, 32)   10240       block35_4_ac[0][0]               \n",
      "__________________________________________________________________________________________________\n",
      "conv2d_39 (Conv2D)              (None, 35, 35, 32)   9216        activation_38[0][0]              \n",
      "__________________________________________________________________________________________________\n",
      "conv2d_42 (Conv2D)              (None, 35, 35, 64)   27648       activation_41[0][0]              \n",
      "__________________________________________________________________________________________________\n",
      "batch_normalization_37 (BatchNo (None, 35, 35, 32)   96          conv2d_37[0][0]                  \n",
      "__________________________________________________________________________________________________\n",
      "batch_normalization_39 (BatchNo (None, 35, 35, 32)   96          conv2d_39[0][0]                  \n",
      "__________________________________________________________________________________________________\n",
      "batch_normalization_42 (BatchNo (None, 35, 35, 64)   192         conv2d_42[0][0]                  \n",
      "__________________________________________________________________________________________________\n",
      "activation_37 (Activation)      (None, 35, 35, 32)   0           batch_normalization_37[0][0]     \n",
      "__________________________________________________________________________________________________\n",
      "activation_39 (Activation)      (None, 35, 35, 32)   0           batch_normalization_39[0][0]     \n",
      "__________________________________________________________________________________________________\n",
      "activation_42 (Activation)      (None, 35, 35, 64)   0           batch_normalization_42[0][0]     \n",
      "__________________________________________________________________________________________________\n",
      "block35_5_mixed (Concatenate)   (None, 35, 35, 128)  0           activation_37[0][0]              \n",
      "                                                                 activation_39[0][0]              \n",
      "                                                                 activation_42[0][0]              \n",
      "__________________________________________________________________________________________________\n",
      "block35_5_conv (Conv2D)         (None, 35, 35, 320)  41280       block35_5_mixed[0][0]            \n",
      "__________________________________________________________________________________________________\n",
      "block35_5 (Lambda)              (None, 35, 35, 320)  0           block35_4_ac[0][0]               \n",
      "                                                                 block35_5_conv[0][0]             \n",
      "__________________________________________________________________________________________________\n",
      "block35_5_ac (Activation)       (None, 35, 35, 320)  0           block35_5[0][0]                  \n",
      "__________________________________________________________________________________________________\n",
      "conv2d_46 (Conv2D)              (None, 35, 35, 32)   10240       block35_5_ac[0][0]               \n",
      "__________________________________________________________________________________________________\n",
      "batch_normalization_46 (BatchNo (None, 35, 35, 32)   96          conv2d_46[0][0]                  \n",
      "__________________________________________________________________________________________________\n",
      "activation_46 (Activation)      (None, 35, 35, 32)   0           batch_normalization_46[0][0]     \n",
      "__________________________________________________________________________________________________\n",
      "conv2d_44 (Conv2D)              (None, 35, 35, 32)   10240       block35_5_ac[0][0]               \n",
      "__________________________________________________________________________________________________\n",
      "conv2d_47 (Conv2D)              (None, 35, 35, 48)   13824       activation_46[0][0]              \n",
      "__________________________________________________________________________________________________\n",
      "batch_normalization_44 (BatchNo (None, 35, 35, 32)   96          conv2d_44[0][0]                  \n",
      "__________________________________________________________________________________________________\n",
      "batch_normalization_47 (BatchNo (None, 35, 35, 48)   144         conv2d_47[0][0]                  \n",
      "__________________________________________________________________________________________________\n",
      "activation_44 (Activation)      (None, 35, 35, 32)   0           batch_normalization_44[0][0]     \n",
      "__________________________________________________________________________________________________\n",
      "activation_47 (Activation)      (None, 35, 35, 48)   0           batch_normalization_47[0][0]     \n",
      "__________________________________________________________________________________________________\n",
      "conv2d_43 (Conv2D)              (None, 35, 35, 32)   10240       block35_5_ac[0][0]               \n",
      "__________________________________________________________________________________________________\n",
      "conv2d_45 (Conv2D)              (None, 35, 35, 32)   9216        activation_44[0][0]              \n",
      "__________________________________________________________________________________________________\n",
      "conv2d_48 (Conv2D)              (None, 35, 35, 64)   27648       activation_47[0][0]              \n",
      "__________________________________________________________________________________________________\n",
      "batch_normalization_43 (BatchNo (None, 35, 35, 32)   96          conv2d_43[0][0]                  \n",
      "__________________________________________________________________________________________________\n",
      "batch_normalization_45 (BatchNo (None, 35, 35, 32)   96          conv2d_45[0][0]                  \n",
      "__________________________________________________________________________________________________\n",
      "batch_normalization_48 (BatchNo (None, 35, 35, 64)   192         conv2d_48[0][0]                  \n",
      "__________________________________________________________________________________________________\n",
      "activation_43 (Activation)      (None, 35, 35, 32)   0           batch_normalization_43[0][0]     \n",
      "__________________________________________________________________________________________________\n",
      "activation_45 (Activation)      (None, 35, 35, 32)   0           batch_normalization_45[0][0]     \n",
      "__________________________________________________________________________________________________\n",
      "activation_48 (Activation)      (None, 35, 35, 64)   0           batch_normalization_48[0][0]     \n",
      "__________________________________________________________________________________________________\n",
      "block35_6_mixed (Concatenate)   (None, 35, 35, 128)  0           activation_43[0][0]              \n",
      "                                                                 activation_45[0][0]              \n",
      "                                                                 activation_48[0][0]              \n",
      "__________________________________________________________________________________________________\n",
      "block35_6_conv (Conv2D)         (None, 35, 35, 320)  41280       block35_6_mixed[0][0]            \n",
      "__________________________________________________________________________________________________\n",
      "block35_6 (Lambda)              (None, 35, 35, 320)  0           block35_5_ac[0][0]               \n",
      "                                                                 block35_6_conv[0][0]             \n",
      "__________________________________________________________________________________________________\n",
      "block35_6_ac (Activation)       (None, 35, 35, 320)  0           block35_6[0][0]                  \n",
      "__________________________________________________________________________________________________\n",
      "conv2d_52 (Conv2D)              (None, 35, 35, 32)   10240       block35_6_ac[0][0]               \n",
      "__________________________________________________________________________________________________\n",
      "batch_normalization_52 (BatchNo (None, 35, 35, 32)   96          conv2d_52[0][0]                  \n",
      "__________________________________________________________________________________________________\n",
      "activation_52 (Activation)      (None, 35, 35, 32)   0           batch_normalization_52[0][0]     \n",
      "__________________________________________________________________________________________________\n",
      "conv2d_50 (Conv2D)              (None, 35, 35, 32)   10240       block35_6_ac[0][0]               \n",
      "__________________________________________________________________________________________________\n",
      "conv2d_53 (Conv2D)              (None, 35, 35, 48)   13824       activation_52[0][0]              \n",
      "__________________________________________________________________________________________________\n",
      "batch_normalization_50 (BatchNo (None, 35, 35, 32)   96          conv2d_50[0][0]                  \n",
      "__________________________________________________________________________________________________\n",
      "batch_normalization_53 (BatchNo (None, 35, 35, 48)   144         conv2d_53[0][0]                  \n",
      "__________________________________________________________________________________________________\n",
      "activation_50 (Activation)      (None, 35, 35, 32)   0           batch_normalization_50[0][0]     \n",
      "__________________________________________________________________________________________________\n",
      "activation_53 (Activation)      (None, 35, 35, 48)   0           batch_normalization_53[0][0]     \n",
      "__________________________________________________________________________________________________\n",
      "conv2d_49 (Conv2D)              (None, 35, 35, 32)   10240       block35_6_ac[0][0]               \n",
      "__________________________________________________________________________________________________\n",
      "conv2d_51 (Conv2D)              (None, 35, 35, 32)   9216        activation_50[0][0]              \n",
      "__________________________________________________________________________________________________\n",
      "conv2d_54 (Conv2D)              (None, 35, 35, 64)   27648       activation_53[0][0]              \n",
      "__________________________________________________________________________________________________\n",
      "batch_normalization_49 (BatchNo (None, 35, 35, 32)   96          conv2d_49[0][0]                  \n",
      "__________________________________________________________________________________________________\n",
      "batch_normalization_51 (BatchNo (None, 35, 35, 32)   96          conv2d_51[0][0]                  \n",
      "__________________________________________________________________________________________________\n",
      "batch_normalization_54 (BatchNo (None, 35, 35, 64)   192         conv2d_54[0][0]                  \n",
      "__________________________________________________________________________________________________\n",
      "activation_49 (Activation)      (None, 35, 35, 32)   0           batch_normalization_49[0][0]     \n",
      "__________________________________________________________________________________________________\n",
      "activation_51 (Activation)      (None, 35, 35, 32)   0           batch_normalization_51[0][0]     \n",
      "__________________________________________________________________________________________________\n",
      "activation_54 (Activation)      (None, 35, 35, 64)   0           batch_normalization_54[0][0]     \n",
      "__________________________________________________________________________________________________\n",
      "block35_7_mixed (Concatenate)   (None, 35, 35, 128)  0           activation_49[0][0]              \n",
      "                                                                 activation_51[0][0]              \n",
      "                                                                 activation_54[0][0]              \n",
      "__________________________________________________________________________________________________\n",
      "block35_7_conv (Conv2D)         (None, 35, 35, 320)  41280       block35_7_mixed[0][0]            \n",
      "__________________________________________________________________________________________________\n",
      "block35_7 (Lambda)              (None, 35, 35, 320)  0           block35_6_ac[0][0]               \n",
      "                                                                 block35_7_conv[0][0]             \n",
      "__________________________________________________________________________________________________\n",
      "block35_7_ac (Activation)       (None, 35, 35, 320)  0           block35_7[0][0]                  \n",
      "__________________________________________________________________________________________________\n",
      "conv2d_58 (Conv2D)              (None, 35, 35, 32)   10240       block35_7_ac[0][0]               \n",
      "__________________________________________________________________________________________________\n",
      "batch_normalization_58 (BatchNo (None, 35, 35, 32)   96          conv2d_58[0][0]                  \n",
      "__________________________________________________________________________________________________\n",
      "activation_58 (Activation)      (None, 35, 35, 32)   0           batch_normalization_58[0][0]     \n",
      "__________________________________________________________________________________________________\n",
      "conv2d_56 (Conv2D)              (None, 35, 35, 32)   10240       block35_7_ac[0][0]               \n",
      "__________________________________________________________________________________________________\n",
      "conv2d_59 (Conv2D)              (None, 35, 35, 48)   13824       activation_58[0][0]              \n",
      "__________________________________________________________________________________________________\n",
      "batch_normalization_56 (BatchNo (None, 35, 35, 32)   96          conv2d_56[0][0]                  \n",
      "__________________________________________________________________________________________________\n",
      "batch_normalization_59 (BatchNo (None, 35, 35, 48)   144         conv2d_59[0][0]                  \n",
      "__________________________________________________________________________________________________\n",
      "activation_56 (Activation)      (None, 35, 35, 32)   0           batch_normalization_56[0][0]     \n",
      "__________________________________________________________________________________________________\n",
      "activation_59 (Activation)      (None, 35, 35, 48)   0           batch_normalization_59[0][0]     \n",
      "__________________________________________________________________________________________________\n",
      "conv2d_55 (Conv2D)              (None, 35, 35, 32)   10240       block35_7_ac[0][0]               \n",
      "__________________________________________________________________________________________________\n",
      "conv2d_57 (Conv2D)              (None, 35, 35, 32)   9216        activation_56[0][0]              \n",
      "__________________________________________________________________________________________________\n",
      "conv2d_60 (Conv2D)              (None, 35, 35, 64)   27648       activation_59[0][0]              \n",
      "__________________________________________________________________________________________________\n",
      "batch_normalization_55 (BatchNo (None, 35, 35, 32)   96          conv2d_55[0][0]                  \n",
      "__________________________________________________________________________________________________\n",
      "batch_normalization_57 (BatchNo (None, 35, 35, 32)   96          conv2d_57[0][0]                  \n",
      "__________________________________________________________________________________________________\n",
      "batch_normalization_60 (BatchNo (None, 35, 35, 64)   192         conv2d_60[0][0]                  \n",
      "__________________________________________________________________________________________________\n",
      "activation_55 (Activation)      (None, 35, 35, 32)   0           batch_normalization_55[0][0]     \n",
      "__________________________________________________________________________________________________\n",
      "activation_57 (Activation)      (None, 35, 35, 32)   0           batch_normalization_57[0][0]     \n",
      "__________________________________________________________________________________________________\n",
      "activation_60 (Activation)      (None, 35, 35, 64)   0           batch_normalization_60[0][0]     \n",
      "__________________________________________________________________________________________________\n",
      "block35_8_mixed (Concatenate)   (None, 35, 35, 128)  0           activation_55[0][0]              \n",
      "                                                                 activation_57[0][0]              \n",
      "                                                                 activation_60[0][0]              \n",
      "__________________________________________________________________________________________________\n",
      "block35_8_conv (Conv2D)         (None, 35, 35, 320)  41280       block35_8_mixed[0][0]            \n",
      "__________________________________________________________________________________________________\n",
      "block35_8 (Lambda)              (None, 35, 35, 320)  0           block35_7_ac[0][0]               \n",
      "                                                                 block35_8_conv[0][0]             \n",
      "__________________________________________________________________________________________________\n",
      "block35_8_ac (Activation)       (None, 35, 35, 320)  0           block35_8[0][0]                  \n",
      "__________________________________________________________________________________________________\n",
      "conv2d_64 (Conv2D)              (None, 35, 35, 32)   10240       block35_8_ac[0][0]               \n",
      "__________________________________________________________________________________________________\n",
      "batch_normalization_64 (BatchNo (None, 35, 35, 32)   96          conv2d_64[0][0]                  \n",
      "__________________________________________________________________________________________________\n",
      "activation_64 (Activation)      (None, 35, 35, 32)   0           batch_normalization_64[0][0]     \n",
      "__________________________________________________________________________________________________\n",
      "conv2d_62 (Conv2D)              (None, 35, 35, 32)   10240       block35_8_ac[0][0]               \n",
      "__________________________________________________________________________________________________\n",
      "conv2d_65 (Conv2D)              (None, 35, 35, 48)   13824       activation_64[0][0]              \n",
      "__________________________________________________________________________________________________\n",
      "batch_normalization_62 (BatchNo (None, 35, 35, 32)   96          conv2d_62[0][0]                  \n",
      "__________________________________________________________________________________________________\n",
      "batch_normalization_65 (BatchNo (None, 35, 35, 48)   144         conv2d_65[0][0]                  \n",
      "__________________________________________________________________________________________________\n",
      "activation_62 (Activation)      (None, 35, 35, 32)   0           batch_normalization_62[0][0]     \n",
      "__________________________________________________________________________________________________\n",
      "activation_65 (Activation)      (None, 35, 35, 48)   0           batch_normalization_65[0][0]     \n",
      "__________________________________________________________________________________________________\n",
      "conv2d_61 (Conv2D)              (None, 35, 35, 32)   10240       block35_8_ac[0][0]               \n",
      "__________________________________________________________________________________________________\n",
      "conv2d_63 (Conv2D)              (None, 35, 35, 32)   9216        activation_62[0][0]              \n",
      "__________________________________________________________________________________________________\n",
      "conv2d_66 (Conv2D)              (None, 35, 35, 64)   27648       activation_65[0][0]              \n",
      "__________________________________________________________________________________________________\n",
      "batch_normalization_61 (BatchNo (None, 35, 35, 32)   96          conv2d_61[0][0]                  \n",
      "__________________________________________________________________________________________________\n",
      "batch_normalization_63 (BatchNo (None, 35, 35, 32)   96          conv2d_63[0][0]                  \n",
      "__________________________________________________________________________________________________\n",
      "batch_normalization_66 (BatchNo (None, 35, 35, 64)   192         conv2d_66[0][0]                  \n",
      "__________________________________________________________________________________________________\n",
      "activation_61 (Activation)      (None, 35, 35, 32)   0           batch_normalization_61[0][0]     \n",
      "__________________________________________________________________________________________________\n",
      "activation_63 (Activation)      (None, 35, 35, 32)   0           batch_normalization_63[0][0]     \n",
      "__________________________________________________________________________________________________\n",
      "activation_66 (Activation)      (None, 35, 35, 64)   0           batch_normalization_66[0][0]     \n",
      "__________________________________________________________________________________________________\n",
      "block35_9_mixed (Concatenate)   (None, 35, 35, 128)  0           activation_61[0][0]              \n",
      "                                                                 activation_63[0][0]              \n",
      "                                                                 activation_66[0][0]              \n",
      "__________________________________________________________________________________________________\n",
      "block35_9_conv (Conv2D)         (None, 35, 35, 320)  41280       block35_9_mixed[0][0]            \n",
      "__________________________________________________________________________________________________\n",
      "block35_9 (Lambda)              (None, 35, 35, 320)  0           block35_8_ac[0][0]               \n",
      "                                                                 block35_9_conv[0][0]             \n",
      "__________________________________________________________________________________________________\n",
      "block35_9_ac (Activation)       (None, 35, 35, 320)  0           block35_9[0][0]                  \n",
      "__________________________________________________________________________________________________\n",
      "conv2d_70 (Conv2D)              (None, 35, 35, 32)   10240       block35_9_ac[0][0]               \n",
      "__________________________________________________________________________________________________\n",
      "batch_normalization_70 (BatchNo (None, 35, 35, 32)   96          conv2d_70[0][0]                  \n",
      "__________________________________________________________________________________________________\n",
      "activation_70 (Activation)      (None, 35, 35, 32)   0           batch_normalization_70[0][0]     \n",
      "__________________________________________________________________________________________________\n",
      "conv2d_68 (Conv2D)              (None, 35, 35, 32)   10240       block35_9_ac[0][0]               \n",
      "__________________________________________________________________________________________________\n",
      "conv2d_71 (Conv2D)              (None, 35, 35, 48)   13824       activation_70[0][0]              \n",
      "__________________________________________________________________________________________________\n",
      "batch_normalization_68 (BatchNo (None, 35, 35, 32)   96          conv2d_68[0][0]                  \n",
      "__________________________________________________________________________________________________\n",
      "batch_normalization_71 (BatchNo (None, 35, 35, 48)   144         conv2d_71[0][0]                  \n",
      "__________________________________________________________________________________________________\n",
      "activation_68 (Activation)      (None, 35, 35, 32)   0           batch_normalization_68[0][0]     \n",
      "__________________________________________________________________________________________________\n",
      "activation_71 (Activation)      (None, 35, 35, 48)   0           batch_normalization_71[0][0]     \n",
      "__________________________________________________________________________________________________\n",
      "conv2d_67 (Conv2D)              (None, 35, 35, 32)   10240       block35_9_ac[0][0]               \n",
      "__________________________________________________________________________________________________\n",
      "conv2d_69 (Conv2D)              (None, 35, 35, 32)   9216        activation_68[0][0]              \n",
      "__________________________________________________________________________________________________\n",
      "conv2d_72 (Conv2D)              (None, 35, 35, 64)   27648       activation_71[0][0]              \n",
      "__________________________________________________________________________________________________\n",
      "batch_normalization_67 (BatchNo (None, 35, 35, 32)   96          conv2d_67[0][0]                  \n",
      "__________________________________________________________________________________________________\n",
      "batch_normalization_69 (BatchNo (None, 35, 35, 32)   96          conv2d_69[0][0]                  \n",
      "__________________________________________________________________________________________________\n",
      "batch_normalization_72 (BatchNo (None, 35, 35, 64)   192         conv2d_72[0][0]                  \n",
      "__________________________________________________________________________________________________\n",
      "activation_67 (Activation)      (None, 35, 35, 32)   0           batch_normalization_67[0][0]     \n",
      "__________________________________________________________________________________________________\n",
      "activation_69 (Activation)      (None, 35, 35, 32)   0           batch_normalization_69[0][0]     \n",
      "__________________________________________________________________________________________________\n",
      "activation_72 (Activation)      (None, 35, 35, 64)   0           batch_normalization_72[0][0]     \n",
      "__________________________________________________________________________________________________\n",
      "block35_10_mixed (Concatenate)  (None, 35, 35, 128)  0           activation_67[0][0]              \n",
      "                                                                 activation_69[0][0]              \n",
      "                                                                 activation_72[0][0]              \n",
      "__________________________________________________________________________________________________\n",
      "block35_10_conv (Conv2D)        (None, 35, 35, 320)  41280       block35_10_mixed[0][0]           \n",
      "__________________________________________________________________________________________________\n",
      "block35_10 (Lambda)             (None, 35, 35, 320)  0           block35_9_ac[0][0]               \n",
      "                                                                 block35_10_conv[0][0]            \n",
      "__________________________________________________________________________________________________\n",
      "block35_10_ac (Activation)      (None, 35, 35, 320)  0           block35_10[0][0]                 \n",
      "__________________________________________________________________________________________________\n",
      "conv2d_74 (Conv2D)              (None, 35, 35, 256)  81920       block35_10_ac[0][0]              \n",
      "__________________________________________________________________________________________________\n",
      "batch_normalization_74 (BatchNo (None, 35, 35, 256)  768         conv2d_74[0][0]                  \n",
      "__________________________________________________________________________________________________\n",
      "activation_74 (Activation)      (None, 35, 35, 256)  0           batch_normalization_74[0][0]     \n",
      "__________________________________________________________________________________________________\n",
      "conv2d_75 (Conv2D)              (None, 35, 35, 256)  589824      activation_74[0][0]              \n",
      "__________________________________________________________________________________________________\n",
      "batch_normalization_75 (BatchNo (None, 35, 35, 256)  768         conv2d_75[0][0]                  \n",
      "__________________________________________________________________________________________________\n",
      "activation_75 (Activation)      (None, 35, 35, 256)  0           batch_normalization_75[0][0]     \n",
      "__________________________________________________________________________________________________\n",
      "conv2d_73 (Conv2D)              (None, 17, 17, 384)  1105920     block35_10_ac[0][0]              \n",
      "__________________________________________________________________________________________________\n",
      "conv2d_76 (Conv2D)              (None, 17, 17, 384)  884736      activation_75[0][0]              \n",
      "__________________________________________________________________________________________________\n",
      "batch_normalization_73 (BatchNo (None, 17, 17, 384)  1152        conv2d_73[0][0]                  \n",
      "__________________________________________________________________________________________________\n",
      "batch_normalization_76 (BatchNo (None, 17, 17, 384)  1152        conv2d_76[0][0]                  \n",
      "__________________________________________________________________________________________________\n",
      "activation_73 (Activation)      (None, 17, 17, 384)  0           batch_normalization_73[0][0]     \n",
      "__________________________________________________________________________________________________\n",
      "activation_76 (Activation)      (None, 17, 17, 384)  0           batch_normalization_76[0][0]     \n",
      "__________________________________________________________________________________________________\n",
      "max_pooling2d_3 (MaxPooling2D)  (None, 17, 17, 320)  0           block35_10_ac[0][0]              \n",
      "__________________________________________________________________________________________________\n",
      "mixed_6a (Concatenate)          (None, 17, 17, 1088) 0           activation_73[0][0]              \n",
      "                                                                 activation_76[0][0]              \n",
      "                                                                 max_pooling2d_3[0][0]            \n",
      "__________________________________________________________________________________________________\n",
      "global_average_pooling2d_1 (Glo (None, 1088)         0           mixed_6a[0][0]                   \n",
      "__________________________________________________________________________________________________\n",
      "dense_1 (Dense)                 (None, 128)          139392      global_average_pooling2d_1[0][0] \n",
      "__________________________________________________________________________________________________\n",
      "dropout_1 (Dropout)             (None, 128)          0           dense_1[0][0]                    \n",
      "__________________________________________________________________________________________________\n",
      "dense_2 (Dense)                 (None, 40)           5160        dropout_1[0][0]                  \n",
      "==================================================================================================\n",
      "Total params: 4,486,792\n",
      "Trainable params: 4,477,576\n",
      "Non-trainable params: 9,216\n",
      "__________________________________________________________________________________________________\n"
     ]
    }
   ],
   "source": [
    "x = base_model.get_layer('mixed_6a').output\n",
    "x = GlobalAveragePooling2D()(x)\n",
    "x = Dense(128, activation='relu')(x)\n",
    "x=Dropout(0.3)(x)\n",
    "\n",
    "predictions = Dense(n_classess, activation='softmax')(x)\n",
    "model = Model(inputs=base_model.input, outputs=predictions)\n",
    "model.summary()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 12,
   "metadata": {},
   "outputs": [],
   "source": [
    "with open(f'../tmp/model_{__file__}.json','w') as f:\n",
    "    model_json = model.to_json()\n",
    "    f.write(model_json)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 13,
   "metadata": {},
   "outputs": [],
   "source": [
    "ckpt = ModelCheckpoint('../tmp/ckpt-'+__file__+'-Epoch_{epoch:03d}-acc_{acc:.5f}-val_acc_{val_acc:.5f}.h5', save_best_only=True, monitor='val_acc')\n",
    "\n",
    "estop = EarlyStopping(monitor='val_acc', min_delta=1e-7,verbose=1, patience=20)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "WARNING:tensorflow:From /usr/local/lib/python3.6/dist-packages/tensorflow/python/ops/math_ops.py:3066: to_int32 (from tensorflow.python.ops.math_ops) is deprecated and will be removed in a future version.\n",
      "Instructions for updating:\n",
      "Use tf.cast instead.\n",
      "Epoch 1/100\n",
      "625/625 [==============================] - 708s 1s/step - loss: 2.5887 - acc: 0.3271 - val_loss: 1.6559 - val_acc: 0.5873\n",
      "Epoch 2/100\n",
      "625/625 [==============================] - 731s 1s/step - loss: 1.5602 - acc: 0.5708 - val_loss: 1.1681 - val_acc: 0.6781\n",
      "Epoch 3/100\n",
      "625/625 [==============================] - 720s 1s/step - loss: 1.1559 - acc: 0.6775 - val_loss: 0.9316 - val_acc: 0.7457\n",
      "Epoch 4/100\n",
      "625/625 [==============================] - 729s 1s/step - loss: 0.8888 - acc: 0.7533 - val_loss: 0.8832 - val_acc: 0.7440\n",
      "Epoch 5/100\n",
      "625/625 [==============================] - 733s 1s/step - loss: 0.6978 - acc: 0.8067 - val_loss: 0.7851 - val_acc: 0.7694\n",
      "Epoch 6/100\n",
      "625/625 [==============================] - 734s 1s/step - loss: 0.5415 - acc: 0.8507 - val_loss: 0.7732 - val_acc: 0.7739\n",
      "Epoch 7/100\n",
      "625/625 [==============================] - 732s 1s/step - loss: 0.4289 - acc: 0.8845 - val_loss: 0.7670 - val_acc: 0.7838\n",
      "Epoch 8/100\n",
      "625/625 [==============================] - 735s 1s/step - loss: 0.3377 - acc: 0.9093 - val_loss: 0.7062 - val_acc: 0.7893\n",
      "Epoch 9/100\n",
      "625/625 [==============================] - 734s 1s/step - loss: 0.2649 - acc: 0.9325 - val_loss: 0.7129 - val_acc: 0.7989\n",
      "Epoch 10/100\n",
      "625/625 [==============================] - 731s 1s/step - loss: 0.2074 - acc: 0.9489 - val_loss: 0.7510 - val_acc: 0.7835\n",
      "Epoch 11/100\n",
      "625/625 [==============================] - 728s 1s/step - loss: 0.1633 - acc: 0.9610 - val_loss: 0.7565 - val_acc: 0.7893\n",
      "Epoch 12/100\n",
      "625/625 [==============================] - 732s 1s/step - loss: 0.1285 - acc: 0.9709 - val_loss: 0.8047 - val_acc: 0.7999\n",
      "Epoch 13/100\n",
      "625/625 [==============================] - 735s 1s/step - loss: 0.1066 - acc: 0.9761 - val_loss: 0.7720 - val_acc: 0.7938\n",
      "Epoch 14/100\n",
      "625/625 [==============================] - 731s 1s/step - loss: 0.0915 - acc: 0.9787 - val_loss: 0.8691 - val_acc: 0.7835\n",
      "Epoch 15/100\n",
      "625/625 [==============================] - 735s 1s/step - loss: 0.0806 - acc: 0.9806 - val_loss: 0.7951 - val_acc: 0.7992\n",
      "Epoch 16/100\n",
      "625/625 [==============================] - 728s 1s/step - loss: 0.0649 - acc: 0.9867 - val_loss: 0.8943 - val_acc: 0.7769\n",
      "Epoch 17/100\n",
      "625/625 [==============================] - 731s 1s/step - loss: 0.0626 - acc: 0.9854 - val_loss: 0.9094 - val_acc: 0.7848\n",
      "Epoch 18/100\n",
      "274/625 [============>.................] - ETA: 6:17 - loss: 0.0549 - acc: 0.9882"
     ]
    }
   ],
   "source": [
    "model.compile(optimizer=Adam(lr=1e-4), loss='categorical_crossentropy', metrics=['accuracy'])\n",
    "\n",
    "model.fit_generator(\n",
    "    train_g,\n",
    "    # steps_per_epoch=100,\n",
    "    steps_per_epoch=train_g.n // batch_size,\n",
    "    epochs=100,\n",
    "    callbacks=[ckpt, estop],\n",
    "    validation_data=valid_g,\n",
    "    # validation_steps=1,\n",
    "    validation_steps=valid_g.n // batch_size\n",
    ")"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "!ls"
   ]
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.6.8"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 2
}
